<template>
  <div class="app-container">
    <div class="listBox">
      <div class="listBox_head">
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增发行方</el-button>
          </el-col>
        </el-row>
      </div>
      <el-table v-loading="loading" :data="tableList" stripe border>
        <el-table-column label="序号" align="center" type="index" width="64px" />
        <el-table-column label="发行方logo" align="center" prop="time" :show-overflow-tooltip="true" width="280px">
          <template slot-scope="scope">
            <img class="img_box" :src="scope.row.logo" alt="">
          </template>
        </el-table-column>
        <el-table-column label="发行方名称" align="center" prop="name" :show-overflow-tooltip="true" />
        <el-table-column label="编辑时间" align="center" prop="updateTime" :show-overflow-tooltip="true" />
        <el-table-column label="操作" align="center" width="240" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="handleUpdate(scope.row)">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
        @pagination="getList" />
    </div>
    <!-- 编辑时间 -->
    <el-dialog title="编辑时间" :visible.sync="dialogVisible" width="400px">
      <el-date-picker style="width:100%" v-model="timeValue" type="datetime" placeholder="选择日期时间">
      </el-date-picker>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <Dialog ref="dialog" @refresh="getList"></Dialog>
  </div>
</template>

<script>
  import {
    issuerList,
  } from "@/api/equityManager/IssuerConfigure";
  import Dialog from "@/views/equityManager/IssuerConfigure/dialog";
  export default {
    // dicts: ['equity_card_issue_type', 'equity_card_sell_status'],
    name: "",
    components: {
      Dialog,
    },
    data() {
      return {
        //日期
        date: [],
        timeValue:'',//编辑时间
        dialogVisible: false,
        // 遮罩层
        loading: false,
        // 导出遮罩层
        exportLoading: false,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 表格数据
        tableList: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          cardName: '', //权益卡名称
          startTime: '', //可售开始时间
          endTime: '', //可售结束时间
          issueType: '', //发行方式
          name: '', //发行方
          sellStatus: '', //销售状态 1 未开售 2出售中 3暂停出售 4 已售完 5未开放预约 6 开放预约 7 中签购买
        },
      };
    },
    created() {
      this.getList();
      console.log(this.dict)
    },
    methods: {
      /** 查询发行管理列表 */
      getList() {
        this.loading = true;
        issuerList(this.queryParams).then(response => {
          this.tableList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 表单重置
      reset() {
        this.date = []
        this.queryParams = {
          pageNum: 1,
          pageSize: 10,
          cardName: '', //权益卡名称
          startTime: '', //可售开始时间
          endTime: '', //可售结束时间
          issueType: '', //发行方式
          name: '', //发行方
          sellStatus: '', //销售状态 1 未开售 2出售中 3暂停出售 4 已售完 5未开放预约 6 开放预约 7 中签购买
        }
        // this.resetForm("form");
        this.handleQuery()
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.$refs.dialog.open();
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.$refs.dialog.open(row.id, false, row.cardId);
      },
      /** 编辑时间 */
      editTime(time) {
        console.log(time)
        this.timeValue = time
        this.dialogVisible = true
      },
      /** 详情按钮操作 */
      handleView(row) {
        this.$refs.dialog.open(row.id, true, row.cardId);
      },
    }
  };

</script>
<style scoped>
  .head {
    box-shadow: 0px 4px 12px 0px rgb(1 41 99 / 6%);
    background-color: #fff;
    border-radius: 8px;
    padding: 20px 20px 0;
  }

  .listBox {
    box-shadow: 0px 4px 12px 0px rgb(1 41 99 / 6%);
    background-color: #fff;
    border-radius: 8px;
    padding: 20px 20px;
    margin-top: 10px;
  }

  .listBox_head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
  }

  .img_box {
    width: 80px;
    object-fit: contain;
  }

  .time_box {
    cursor: pointer;
  }

  .time_box:hover {
    color: #1890FF;
  }

</style>
